Telegram Group & Telegram Channel
#include <Wire.h>

void setup() { Wire.begin(); //creates a Wire object

// set I/O pins to outputs
Wire.beginTransmission(0x20); //begins talking to the slave device
Wire.write(0x00); //selects the IODIRA register
Wire.write(0x00); //this sets all port A pins to outputs
Wire.endTransmission(); //stops talking to device
Wire.beginTransmission(0x20);//begins talking again to slave device
Wire.write(0x01); //selects the IODIRB register
Wire.write(0x00); // sets all port B pins to outputs
Wire.endTransmission(); //ends communication with slave device
}

void loop()
{
Wire.beginTransmission(0x20); //starts talking to slave device
Wire.write(0x12); //selects the GPIOA pins
Wire.write(00000011); // turns on pins 0 and 1 of GPIOA
Wire.endTransmission(); //ends communication with the device
Wire.beginTransmission(0x20); //starts talking to slave device
Wire.write(0x13); //selects the GPIOB pins
Wire.write(00000001); //turns on pin 0 of GPIOA
Wire.endTransmission();//ends communication with the device
}



tg-me.com/micropython_iot/206
Create:
Last Update:

#include <Wire.h>

void setup() { Wire.begin(); //creates a Wire object

// set I/O pins to outputs
Wire.beginTransmission(0x20); //begins talking to the slave device
Wire.write(0x00); //selects the IODIRA register
Wire.write(0x00); //this sets all port A pins to outputs
Wire.endTransmission(); //stops talking to device
Wire.beginTransmission(0x20);//begins talking again to slave device
Wire.write(0x01); //selects the IODIRB register
Wire.write(0x00); // sets all port B pins to outputs
Wire.endTransmission(); //ends communication with slave device
}

void loop()
{
Wire.beginTransmission(0x20); //starts talking to slave device
Wire.write(0x12); //selects the GPIOA pins
Wire.write(00000011); // turns on pins 0 and 1 of GPIOA
Wire.endTransmission(); //ends communication with the device
Wire.beginTransmission(0x20); //starts talking to slave device
Wire.write(0x13); //selects the GPIOB pins
Wire.write(00000001); //turns on pin 0 of GPIOA
Wire.endTransmission();//ends communication with the device
}

BY Micropython & IOT




Share with your friend now:
tg-me.com/micropython_iot/206

View MORE
Open in Telegram


Micropython & IOT Telegram | DID YOU KNOW?

Date: |

A project of our size needs at least a few hundred million dollars per year to keep going,” Mr. Durov wrote in his public channel on Telegram late last year. “While doing that, we will remain independent and stay true to our values, redefining how a tech company should operate.

The seemingly negative pandemic effects and resource/product shortages are encouraging and allowing organizations to innovate and change.The news of cash-rich organizations getting ready for the post-Covid growth economy is a sign of more than capital spending plans. Cash provides a cushion for risk-taking and a tool for growth.

Micropython & IOT from ua


Telegram Micropython & IOT
FROM USA